Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate: skip the automigration for gf markdown when user isn't using mdx #22186

Merged
merged 5 commits into from
May 1, 2023

Conversation

ndelangen
Copy link
Member

Closes #22167

What I did

I added a check if the user is actually using MDX files.
If they do not.. we should skip the automigration.

How to test

Run the automigration on a project that has no MDX files

@ndelangen ndelangen requested a review from yannbf April 20, 2023 13:50
@ndelangen ndelangen self-assigned this Apr 20, 2023
@ndelangen ndelangen changed the title add check if the user is using mdx for stories, and if not, skip the automigration for gf markdown Migrate: skip the automigration for gf markdown when user isn't using mdx Apr 20, 2023
@ndelangen ndelangen requested a review from shilman April 20, 2023 14:00
@@ -22,9 +25,27 @@ export const mdxgfm: Fix<Options> = {
return null;
}

const hasMDXFiles = await mainConfig?.stories?.reduce(async (acc, item) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems worse? considering it's not using the glob patterns set in main.ts, and will ignore any MDX files not following the .stories.mdx pattern.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright sounds good, maybe the other automigration should follow this pattern then

@ndelangen ndelangen requested a review from yannbf April 26, 2023 10:41
@ndelangen ndelangen added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Apr 28, 2023
@ndelangen
Copy link
Member Author

@shilman @yannbf can you review / approve?

Copy link
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@ndelangen ndelangen merged commit 7a461f3 into next May 1, 2023
@ndelangen ndelangen deleted the norbert/fix-22167 branch May 1, 2023 15:32
@shilman shilman added bug patch:done Patch/release PRs already cherry-picked to main/release branch and removed feature request labels May 2, 2023
shilman pushed a commit that referenced this pull request May 3, 2023
Migrate: skip the automigration for gf markdown when user isn't using mdx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automigrations bug patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Found a 'github-flavored-markdown-mdx' migration even without mdx files in the project
3 participants